package org.rambadger.deployer.response;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.rambadger.deployer.utils.MutableInt;

import java.lang.management.ManagementFactory;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: chtompki
 * Date: 10/30/13
 * Time: 9:00 PM
 * To change this template use File | Settings | File Templates.
 */
@XmlRootElement
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
public class ServiceResponseObject {

    private List<String> incompleteParams = null;
    private List<String> invalidParams = null;

    @JsonIgnore
    private String errorHandlerDetailCode = null;

    @JsonIgnore
    private JsonNode parsedPayload;

    private String payload;

    @JsonIgnore
    private MutableInt httpResponseCode = new MutableInt();

    public JsonNode getParsedPayload() {
        return parsedPayload;
    }

    public void setParsedPayload(JsonNode parsedPayload) {
        this.parsedPayload = parsedPayload;
    }

    public void setIncompleteParams(List<String> params) {
        incompleteParams = params;
    }

    @XmlElement(name = "incompleteParams")
    public List<String> getIncompleteParams() {
        return incompleteParams;
    }

    public void setInvalidParams(List<String> params) {
        invalidParams = params;
    }

    @XmlElement(name = "invalidParams")
    public List<String> getInvalidParams() {
        return invalidParams;
    }

    /**
     * @return the httpResponseCode
     */
    public MutableInt getHttpResponseCode() {
        return httpResponseCode;
    }

    /**
     * @param httpResponseCode the httpResponseCode to set
     */
    public void setHttpResponseCode(MutableInt httpResponseCode) {
        this.httpResponseCode = httpResponseCode;
    }

    /**
     * @param httpResponseCode the integer value of the httpResponseCode to set
     */
    public void setHttpResponseCode(int httpResponseCode) {
        this.httpResponseCode.setValue(httpResponseCode);
    }

    /**
     * @return the payLoad
     */
    @XmlElement(name = "payload")
    public String getPayload() {
        return payload;
    }

    /**
     * @param payLoad the payLoad to set
     */
    public void setPayload(String payLoad) {
        this.payload = payLoad;
    }

    public String getErrorHandlerDetailCode() {
        return errorHandlerDetailCode;
    }

    /**
     *
     * @param errorHandlerDetailCode unique code comprised of the http response code & a value
     * that will help to identify what type of exception occurred.
     */
    public void setErrorHandlerDetailCode(String errorHandlerDetailCode) {
        this.errorHandlerDetailCode = errorHandlerDetailCode;
    }

}
